package com.changgou.user.feign;

import com.changgou.entity.Result;
import com.changgou.user.pojo.Address;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "user")
public interface AddressFeign {

    @GetMapping("/address/list")
    public Result<List<Address>> list();

    /***
     * 根据ID查询数据
     * @param id
     * @return
     */
    @GetMapping("/address/{id}")
    public Result<Address> findById(@PathVariable("id") Integer id);

    /***
     * 根据ID删除品牌数据
     * @param id
     * @return
     */
    @DeleteMapping(value = "/address/{id}" )
    public Result delete(@PathVariable("id") Integer id);

    /***
     * 修改数据
     * @param address
     * @param id
     * @return
     */
    @PutMapping(value="/address/{id}")
    public Result update(@RequestBody Address address, @PathVariable("id") Integer id);

    /**
     * 修改默认地址
     */
    @PutMapping("/address/editDefault/{id}")
    public Result editDefault(@PathVariable("id")Integer id);

    /***
     * 新增数据
     * @param address
     * @return
     */
    @PostMapping("/address")
    public Result add(@RequestBody Address address);
}
